<?php
class Item{
    public $app;
    public $config;
    public $rootPath;
    public $params;


    public function __construct(){
        $this->app = Basic::app();
        $config = $this->config = $this->app->getConfigs();
        $this->rootPath = $config['base']['root'];
        $this->params = Basic::$route->params;
    }

    /**
     *
     * 创建url
     * @param array $url such as array('post/new')
     * @param array $params such as array('id'=>$id)
     */
    public function createUrl($url,$params=array()){
        $s_url = BASE_URL."/index.php?r={$url}";
        foreach($params as $k=>$v){
            $s_url .='/'.urlencode($k).'/'.urlencode($v);
        }
        return $s_url;
    }
}